package com.member.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.member.common.utils.DateUtils;
import com.member.shop.domain.SysBizUserSurplusDetails;
import com.member.shop.mapper.SysBizUserSurplusDetailsMapper;
import com.member.shop.service.ISysBizUserSurplusDetailsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * 用户余额明细Service业务层处理
 *
 * @author wangxin
 * @date 2024-05-14
 */
@Service
public class SysBizUserSurplusDetailsServiceImpl extends ServiceImpl<SysBizUserSurplusDetailsMapper, SysBizUserSurplusDetails> implements ISysBizUserSurplusDetailsService {
    @Resource
    private SysBizUserSurplusDetailsMapper sysBizUserSurplusDetailsMapper;

    /**
     * 查询用户余额明细
     *
     * @param id 用户余额明细主键
     * @return 用户余额明细
     */
    @Override
    public SysBizUserSurplusDetails selectSysBizUserSurplusDetailsById(Long id) {
        return sysBizUserSurplusDetailsMapper.selectById(id);
    }

    /**
     * 查询用户余额明细列表
     *
     * @param queryWrapper 用户余额明细
     * @return 用户余额明细
     */
    @Override
    public List<SysBizUserSurplusDetails> selectSysBizUserSurplusDetailsList(LambdaQueryWrapper<SysBizUserSurplusDetails> queryWrapper) {
        return sysBizUserSurplusDetailsMapper.selectList(queryWrapper);
    }

    @Override
    public List<SysBizUserSurplusDetails> selectSysBizUserSurplusDetailsList(SysBizUserSurplusDetails sysBizUserSurplusDetails) {
        return sysBizUserSurplusDetailsMapper.selectSysBizUserSurplusDetailsList(sysBizUserSurplusDetails);
    }

    /**
     * 新增用户余额明细
     *
     * @param sysBizUserSurplusDetails 用户余额明细
     * @return 结果
     */
    @Override
    public int insertSysBizUserSurplusDetails(SysBizUserSurplusDetails sysBizUserSurplusDetails) {
        sysBizUserSurplusDetails.setCreateTime(DateUtils.getNowDate());
        return sysBizUserSurplusDetailsMapper.insert(sysBizUserSurplusDetails);
    }

    /**
     * 修改用户余额明细
     *
     * @param sysBizUserSurplusDetails 用户余额明细
     * @return 结果
     */
    @Override
    public int updateSysBizUserSurplusDetails(SysBizUserSurplusDetails sysBizUserSurplusDetails) {
        sysBizUserSurplusDetails.setUpdateTime(DateUtils.getNowDate());
        return sysBizUserSurplusDetailsMapper.updateById(sysBizUserSurplusDetails);
    }

    /**
     * 批量删除用户余额明细
     *
     * @param ids 需要删除的用户余额明细主键
     * @return 结果
     */
    @Override
    public int deleteSysBizUserSurplusDetailsByIds(Long[] ids) {
        return sysBizUserSurplusDetailsMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除用户余额明细信息
     *
     * @param id 用户余额明细主键
     * @return 结果
     */
    @Override
    public int deleteSysBizUserSurplusDetailsById(Long id) {
        return sysBizUserSurplusDetailsMapper.deleteById(id);
    }
}
